/**
 * 作者: wgx
 * 日期: 2024-12-31 17:00:17
 * 备注: 用户子嗣模块表
 */
package com.motu.monstercity.server.game.userdata;

import com.motu.monstercity.protocol.Common.PBUserData;
import com.motu.monstercity.server.game.commondata.maintask.MainTaskConstant;
import com.motu.monstercity.server.game.logic.GameUser;
import com.motu.monstercity.server.game.logic.MainTaskManager;
import com.motu.monstercity.server.game.logic.RankActManager;
import io.vertx.core.json.JsonObject;

public class UserChildInfo extends UserChildInfoModel {
    public UserChildInfo() {
        super();
    }

    public void addGraduationNum(PBUserData.Builder pbUserData, int value) {
        super.addGraduationNum(value);
        UserInfo userInfo = GameUser.getUserInfo(getId());
        MainTaskManager.updateTaskProgress(pbUserData, userInfo, MainTaskConstant.TASK_TYPE_139, (long) getGraduationNum());
        RankActManager.updateTaskProgress(pbUserData, userInfo, MainTaskConstant.TASK_TYPE_139, (long) getGraduationNum());
    }

    // 获取收益最高的子嗣的名称
    public String takeMaxEarnChildName() {
        String name = "";
        try {
            JsonObject jsonObject = new JsonObject(getMaxEarnAddInfo());
            name = jsonObject.getString("name");
        } catch (Exception e) {
        }
        return name;
    }
}
